package de.tum.in.eist.poll.client;

import java.util.Date;
import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

import de.tum.in.eist.poll.shared.Feedback;
import de.tum.in.eist.poll.shared.Lecture;
import de.tum.in.eist.poll.shared.User;

/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath("pollService")
public interface PollService extends RemoteService {
	/**
	 * Requests a login by sending name and password.
	 * 
	 * @param name
	 *            the name sent by the client
	 * @param password
	 *            the password sent by the client
	 * @return the user corresponding to name and password
	 * @throws IllegalArgumentException
	 *             if name and password don't match
	 */
	User login(String name, String password) throws IllegalArgumentException;

	/**
	 * Ends the current session.
	 */
	void logout();

	/**
	 * Requests a list of all lectures relevant to this user.
	 * 
	 * @return a list of all lectures relevant to the user
	 */
	List<Lecture> requestLectures();

	/**
	 * Returns a list of dates on which this lecture has occured to the
	 * lecturer.
	 * 
	 * @param lectureID
	 *            Lecture to consider
	 * @return A list of the Dates
	 */
	List<Date> getLectureDates(String lectureID);

	/**
	 * Requests all feedback for a lecture.
	 * 
	 * @param lectureID ID of the lecture
	 * @param date Date of the lecture
	 * 
	 * @return all of the feedback corresponding to a lecture
	 */
	List<Feedback> requestFeedback(String lectureID, Date date);

	/**
	 * Submit feedback to the server.
	 * 
	 * @param feedback
	 *            the feedback to submit.
	 * @return the server's answer
	 */
	boolean submitFeedback(Feedback feedback);

	/**
	 * Returns Lectures to which the Student can give feedback.
	 * 
	 * @return A list of lectures
	 */
	List<Lecture> getOpenLectures();

	/**
	 * 
	 * 
	 * @param lectureID ID of the lecture
	 * @return
	 */
	String registerForNewPollData(String lectureID);
}
